package com.herui.ota.controller;

import com.herui.ota.config.ControllerNames;
import com.herui.ota.entity.AppPush;
import com.herui.ota.pojo.form.NoneFilterForm;
import com.herui.ota.service.AppPushService;
import com.mlnx.common.entity.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.shan.spring.base.CurdBaseController;
import org.shan.spring.base.annotations.SysLog;
import org.shan.spring.mybatis.service.ICurdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = ControllerNames.AppPushName + "接口", tags = {ControllerNames.AppPushName + "接口"})
@SysLog(title = ControllerNames.AppPushName)
@RestController
@RequestMapping("/appPush")
public class AppPushController extends CurdBaseController<AppPush, AppPush, AppPush,
        NoneFilterForm> {
    @Autowired
    private AppPushService service;

    @Override
    public ICurdService getService() {
        return service;
    }

    @Override
    public AppPush newInstance(Integer id) {
        AppPush soft = new AppPush();
        soft.setId(id);
        return soft;
    }

    @ApiOperation(
            value = "获取新的推送数据",
            notes = ""
    )
    @PutMapping({"/newPush"})
    public Response channelOpen(String pushUserKey, String language) {
        return this.result(service.getNewAppPush(pushUserKey, language));
    }
}
